<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>02.解构赋值</title>
</head>
<body>
    <script>
        // 1.基本用法
        
        //let name = "张三", age = 18, sex = "男";
        /* let [name,age,sex] = ["李四",20,"女"]
        console.log(name);
        console.log(age);
        console.log(sex); */

        // 2.对象的解构赋值
        /* let {name,age,friends,pet} = {name: '张三',age:'55',friends:['lulu','wuwu'],pet:{name:'土豆',age:'5'}};
        console.log(name);
        console.log(age);
        console.log(friends);
        console.log(pet); */

        // 3.数组的解构赋值
        /* let [arr1,[arr2,arr3,[arr4,arr5]]] = [1, [2,3, [4,5] ] ];
        console.log(arr1,arr2,arr3,arr4,arr5); */
        /* let [arr1] = [];
        console.log(arr1); */
        
        // 4.基本类型的解构赋值
        /* let [a,b,c,d] = '我是中国人';
        console.log(a);
        console.log(b);
        console.log(c);
        console.log(d); */
        
        


    </script>
</body>
</html>